<template>
  <div class="about">
    <h1 @click="speak">闪电五连鞭</h1>
    <!-- <aplayer autoplay
             :music="{
    title: 'secret base~君がくれたもの~',
    artist: 'Silent Siren',
    src: 'https://moeplayer.b0.upaiyun.com/aplayer/secretbase.mp3',
    pic: 'https://moeplayer.b0.upaiyun.com/aplayer/secretbase.jpg'
  }" /> -->
  </div>
</template>

<script>
// import Aplayer from 'vue-aplayer'
import Speech from 'speak-tts'
export default {
  data () {
    return {
      speech: null
    }
  },
  components: {
    // Aplayer
  },
  mounted () {
    this.speechInit();
  },
  methods: {
    to () {
      new Audio(
        'http://tts.baidu.com/text2audio?cuid=baiduid&lan=zh&ctp=1&pdt=311&tex=测试'
      ).play();
    },
    speechInit () {
      this.speech = new Speech();
      this.speech.setLanguage('zh-CN');
      this.speech.init().then(() => {
        console.log('语音播报初始化完成...')
      })
    },

    //语音播报
    speak () {
      this.speech.speak({ text: "雅蠛蝶雅蠛蝶雅蠛蝶雅蠛蝶雅蠛蝶雅蠛蝶" }).then(() => {
        console.log("播报完成...")
      })
    }
  },
}
</script>
